<div id="History-browsing"></div>
<div class="header">
<p>
Next: [[cvs: Handling binary files#Handling binary files|Binary files]], Previous: [[cvs: Adding, removing, and renaming files and directories#Adding, removing, and renaming files and directories|Adding and removing]], Up: [[cvs#Top|Top]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
<div id="History-browsing-1"></div>
== History browsing ==
<div id="index-History-browsing"></div>
<div id="index-Traceability"></div>
<div id="index-Isolation"></div>


Once you have used <small>CVS</small> to store a version control
history&mdash;what files have changed when, how, and by
whom, there are a variety of mechanisms for looking
through the history.

<div class="menu-preformatted" style="font-family: serif">
 [[#Log messages|&bull; log messages]]::                Log messages
 [[#The history database|&bull; history database]]::            The history database
 [[#User-defined logging|&bull; user-defined logging]]::        User-defined logging
 [[#Annotate command|&bull; annotate]]::                    What revision modified each line of a file?
</div>


----

<div id="log-messages"></div>
<div class="header">
<p>
Next: [[#The history database|history database]], Up: [[#History browsing|History browsing]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
<div id="Log-messages"></div>
=== Log messages ===

Whenever you commit a file you specify a log message.

To look through the log messages which have been
specified for every revision which has been committed,
use the <code>cvs log</code> command (see [[cvs: Guide to CVS commands#log&mdash;Print out log information for files|log]]).


----

<div id="history-database"></div>
<div class="header">
<p>
Next: [[#User-defined logging|user-defined logging]], Previous: [[#Log messages|log messages]], Up: [[#History browsing|History browsing]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
<div id="The-history-database"></div>
=== The history database ===

You can use the history file (see [[cvs: Reference manual for Administrative files#The history file|history file]]) to
log various <small>CVS</small> actions.  To retrieve the
information from the history file, use the <code>cvs
history</code> command (see [[cvs: Guide to CVS commands#history&mdash;Show status of files and users|history]]).

Note: you can control what is logged to this file by using the
&lsquo;<code>LogHistory</code>&rsquo; keyword in the &lsquo;<tt>CVSROOT/config</tt>&rsquo; file
(see [[cvs: Reference manual for Administrative files#The CVSROOT/config configuration file|config]]).



----

<div id="user_002ddefined-logging"></div>
<div class="header">
<p>
Next: [[#Annotate command|annotate]], Previous: [[#The history database|history database]], Up: [[#History browsing|History browsing]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
<div id="User_002ddefined-logging"></div>
=== User-defined logging ===

You can customize <small>CVS</small> to log various kinds of
actions, in whatever manner you choose.  These
mechanisms operate by executing a script at various
times.  The script might append a message to a file
listing the information and the programmer who created
it, or send mail to a group of developers, or, perhaps,
post a message to a particular newsgroup.  To log
commits, use the &lsquo;<tt>loginfo</tt>&rsquo; file (see [[cvs: Reference manual for Administrative files#Loginfo|loginfo]]).
To log commits, checkouts, exports, and tags,
respectively, you can also use the &lsquo;<code>-i</code>&rsquo;,
&lsquo;<code>-o</code>&rsquo;, &lsquo;<code>-e</code>&rsquo;, and &lsquo;<code>-t</code>&rsquo; options in the
modules file.  For a more flexible way of giving
notifications to various users, which requires less in
the way of keeping centralized scripts up to date, use
the <code>cvs watch add</code> command (see [[cvs: Multiple developers#Telling CVS to notify you|Getting Notified]]); this command is useful even if you are not
using <code>cvs watch on</code>.

<div id="index-taginfo"></div>
<div id="index-Exit-status_002c-of-taginfo"></div>
The &lsquo;<tt>taginfo</tt>&rsquo; file defines programs to execute
when someone executes a <code>tag</code> or <code>rtag</code>
command.  The &lsquo;<tt>taginfo</tt>&rsquo; file has the standard form
for administrative files (see [[cvs: Reference manual for Administrative files#Reference manual for Administrative files|Administrative files]]), where each line is a regular expression
followed by a command to execute.  The arguments passed
to the command are, in order, the <var>tagname</var>,
<var>operation</var> (<code>add</code> for <code>tag</code>,
<code>mov</code> for <code>tag -F</code>, and <code>del</code> for
<code>tag -d</code>), <var>repository</var>, and any remaining are
pairs of <var>filename</var> <var>revision</var>.  A non-zero
exit of the filter program will cause the tag to be
aborted.

Here is an example of using taginfo to log tag and rtag
commands.  In the taginfo file put:

<div class="example" style="margin-left: 3.2em">
 ALL /usr/local/cvsroot/CVSROOT/loggit
</div>

Where &lsquo;<tt>/usr/local/cvsroot/CVSROOT/loggit</tt>&rsquo; contains the
following script:

<div class="example" style="margin-left: 3.2em">
 #!/bin/sh
 echo &quot;$@&quot; &gt;&gt;/home/kingdon/cvsroot/CVSROOT/taglog
</div>


----

<div id="annotate"></div>
<div class="header">
<p>
Previous: [[#User-defined logging|user-defined logging]], Up: [[#History browsing|History browsing]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
<div id="Annotate-command"></div>
=== Annotate command ===
<div id="index-annotate-_0028subcommand_0029"></div>

;<div id="index-cvs-annotate"></div>Command<nowiki>:</nowiki> <strong>cvs annotate</strong><em> <nowiki>[</nowiki><code>-FflR</code><nowiki>]</nowiki> <nowiki>[</nowiki><code>-r rev</code>|<code>-D date</code><nowiki>]</nowiki> files &hellip;</em>

: For each file in <var>files</var>, print the head revision of the trunk, together with information on the last modification for each line.  For example:

<div class="example" style="margin-left: 3.2em">
 $ cvs annotate ssfile
 Annotations for ssfile
 ***************
 1.1          (mary     27-Mar-96): ssfile line 1
 1.2          (joe      28-Mar-96): ssfile line 2
</div>

: The file &lsquo;<tt>ssfile</tt>&rsquo; currently contains two lines. The <code>ssfile line 1</code> line was checked in by <code>mary</code> on March 27.  Then, on March 28, <code>joe</code> added a line <code>ssfile line 2</code>, without modifying the <code>ssfile line 1</code> line.  This report doesn&rsquo;t tell you anything about lines which have been deleted or replaced; you need to use <code>cvs diff</code> for that (see [[cvs: Guide to CVS commands#diff&mdash;Show differences between revisions|diff]]).


The options to <code>cvs annotate</code> are listed in
[[cvs: Quick reference to CVS commands#Quick reference to CVS commands|Invoking CVS]], and can be used to select the files
and revisions to annotate.  The options are described
in more detail there and in [[cvs: Guide to CVS commands#Common command options|Common options]].



----

<div class="header">
<p>
Previous: [[#User-defined logging|user-defined logging]], Up: [[#History browsing|History browsing]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
This document was generated on <i>a sunny day</i> using [http://www.nongnu.org/texi2html/ <i>texi2html</i>].
